package com.itzxx.huazhun.data.dao

import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.Ignore
import androidx.room.PrimaryKey

/**
 * Desc:
 *
 * Author: zhangxiaoxiao
 * Date: 2024/7/26 16:45
 * Updater:
 * Update Time:
 * Update Comments:
 */
@Entity(tableName = "collection_record")
data class CollectionEntity(

    @ColumnInfo(name = "probe_mac")
    val probe_mac: String,

    @ColumnInfo(name = "sw")
    val sw: Int = 1,

    @ColumnInfo(name = "hw")
    val hw: Int = 1,

    @ColumnInfo(name = "battery")
    val battery: Int,//电池

    @ColumnInfo(name = "feature")
    val feature: Int,//功能

    @ColumnInfo(name = "wayNum")
    val wayNum: Int = 1,//通道数

    @ColumnInfo(name = "wayIndex")
    val wayIndex: String,//通道列表

    @ColumnInfo(name = "recordSamplingInterval")
    val recordSamplingInterval: String,//采集间隔

    @ColumnInfo(name = "recordStartTime")
    val recordStartTime: String,//开始时间

    @ColumnInfo(name = "model")
    val model: String,//厂家

    @ColumnInfo(name = "recordNum")
    val recordNum: Int//记录数量
) {

    /**
     * 主键
     */
    @PrimaryKey(autoGenerate = true)
    var id: Long = 0

    @ColumnInfo(name = "recordId")
    var recordId: String = ""//上传服务端后返回记录id

    @ColumnInfo(name = "equipmentId")
    var equipmentId: Int = 0//设备id

    @ColumnInfo(name = "equipmentName")
    var equipmentName: String = ""//设备名称

    @ColumnInfo(name = "equipmentNo")
    var equipmentNo: String = ""//设备编号

    @ColumnInfo(name = "url")
    var url: String = ""//设备编号

    @ColumnInfo(name = "state")
    var state: Int = 0 //上传状态，0：未上传 1:上传成功

    @Ignore
    var isCheck = false

    fun isExistTemp():Boolean{
        //气压传感器:0
        //温度传感器:1
        //湿度传感器:2
        return wayIndex.contains("1")
    }

    fun isExistAirPressure():Boolean{
        //气压传感器:0
        //温度传感器:1
        //湿度传感器:2
        return wayIndex.contains("0")
    }

}